<template>
  <div>
    <el-form ref="dataForm" v-model="query" class="form">
      <el-form-item prop="ck_007_sys_setting_2_12">
        <el-checkbox v-model="query.ck_007_sys_setting_2_12">库存结转可修改</el-checkbox>
      </el-form-item>
      <el-form-item label="订单出入库设置:" prop="radio">
        <el-radio v-model="query.radio" label="1">签单完成后执行出入库</el-radio>
        <el-radio v-model="query.radio" label="2">回执完成后执行出入库</el-radio>
      </el-form-item>
      <el-form-item prop="ck_007_sys_setting_3_6">
        <el-checkbox v-model="query.ck_007_sys_setting_3_6">启用新版库存</el-checkbox>
      </el-form-item>
      <el-form-item prop="ck_007_sys_setting_3_7">
        <el-checkbox v-model="query.ck_007_sys_setting_3_7">兑换商品启用库存限制</el-checkbox>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
  import { mapGetters } from 'vuex'

  export default {
    name: 'StoreTab',
    data() {
      return {
        query: {
          radio: '1',
          ck_007_sys_setting_2_12: false,
          ck_007_sys_setting_3_6: false,
          ck_007_sys_setting_3_7: false
        }
      }
    },
    computed: {
      ...mapGetters([
        'corpSettingData', 'userInfo'
      ])
    },
    created() {
      this.init()
    },
    methods: {
      init() {
        if (this.corpSettingData) {
          this.query.ck_007_sys_setting_2_12 = !!(this.corpSettingData.sp2 >> 12 & 0x01)
          this.query.ck_007_sys_setting_3_6 = !!(this.corpSettingData.sp3 >> 6 & 0x01)
          this.query.ck_007_sys_setting_3_7 = !!(this.corpSettingData.sp3 >> 7 & 0x01)
          if (this.corpSettingData.sp3 >> 3 & 0x01) {
            this.query.radio = '1'
          } else {
            this.query.radio = '2'
          }
        }
      }
    }
  }
</script>

<style lang="scss" scoped>
.form {
  .el-form-item {
    margin-bottom: 0;
  }
}
</style>
